package com.java80.springmall.cloud.user.provider.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.java80.springmall.cloud.user.provider.entity.User;
import com.java80.springmall.cloud.user.provider.repository.UserRepository;

@RestController
public class UserProviderController {
	@Autowired
	private UserRepository userRepository;

	@GetMapping("/user/get/{id}")
	public User findById(@PathVariable Long id) {
		return this.userRepository.findOne(id);
	}
	@PostMapping("/user/login")
	public User login(String username){
		return userRepository.login(username);
	}
}
